{[{define "admin/admin/role.html"}]}
<style>
    .layui-iconpicker-body.layui-iconpicker-body-page .hide {
        display: none;
    }
</style>
<link rel="stylesheet" href="/static/admin/css/public.css" media="all">
<link rel="stylesheet" href="/static/plugs/layui-v2.5.6/css/layui.css" media="all">
<link rel="stylesheet" href="/static/plugs/lay-module/autocomplete/autocomplete.css" media="all">
<link rel="stylesheet" href="/static/plugs/font-awesome-4.7.0/css/font-awesome.min.css" media="all">



<div class="layuimini-container">
    <form id="app-form" class="layui-form layuimini-form">

        <input type="hidden" name="adminId" value="{[{.item.Id}]}">

        <div class="layui-form-item">
            <label class="layui-form-label required">用户昵称</label>
            <div class="layui-input-block">
                <input type="text" name="name" class="layui-input" lay-verify="required" readonly lay-reqtext="请输入用户昵称" placeholder="请输入用户昵称" value="{[{.item.Name}]}">
                <tip>填写用户昵称。</tip>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label required">账户</label>
            <div class="layui-input-block">
                <input type="text"  name="account" class="layui-input" lay-verify="required" readonly lay-reqtext="请输入账户" placeholder="请输入账户" value="{[{.item.Account}]}">
                <tip>填写账户。</tip>
            </div>
        </div>

        <div class="layui-form-item  layui-row layui-col-xs12">
            <label class="layui-form-label required">选择角色</label>
            <div class="layui-input-block">
                <select name="rid">
                    {[{ $roleId := .roleId }]}
                    {[{ range .list }]}
                    <option value="{[{.Id}]}"
                            {[{if eq  .Id $roleId}]}
                            selected
                            {[{end}]}>
                        {[{.Name}]}
                    </option>
                    {[{ end }]}
                </select>
            </div>
        </div>

        <div class="hr-line"></div>
        <div class="layui-form-item text-center">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit lay-filter="add">确认</button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
        </div>

    </form>
</div>
<script src="/static/layuimini/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script src="/static/layuimini/js/lay-config.js" charset="utf-8"></script>
<script>

    layui.use(['form', 'jquery','sh'], function () {
        var $ = layui.jquery,
            form = layui.form,
            sh = layui.sh;

        form.on('submit(add)', function (data) {
            data = data.field;
            sh.request.post(
                {
                    url: '/admin/admin/role_ajax',
                    data: data,
                }, function (res) {
                    sh.msg.success('选择成功', function () {
                        window.parent.location.reload();//刷新父页面
                        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                        parent.layer.close(index);
                    });
                }
            );
            return false;
        });
    });

</script>
{[{end}]}


